home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 11783 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.8 KB  |  75 lines

  1. Path: lrz-muenchen.de!news
  2. From: ua302aa@lrz-muenchen.de ()
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Please help me
  5. Date: 26 Mar 1996 16:09:08 GMT
  6. Organization: Leibniz-Rechenzentrum, Muenchen (Germany)
  7. Distribution: world
  8. Message-ID: <4j94r4$gqq@sparcserver.lrz-muenchen.de>
  9. References: <4j6oke$lfk@badger.wmin.ac.uk>
  10. NNTP-Posting-Host: sun2.lrz-muenchen.de
  11.  
  12. darec@westminster.ac.uk (Nadarajah Thavaneethan) writes:
  13.  
  14. >#include <std.h>
  15.  
  16. There is no header with that name on _all_ the machines available to
  17. me.
  18.  
  19. >void writelines( char[], int );
  20. >        int index;
  21.  
  22. Is there a good reason to make "index" a global variable.
  23.  
  24. >void main(void)
  25.  
  26. I will not comment on this.
  27.  
  28. >{
  29. >int i;
  30. >char rest[80];
  31. >    printf("Enter line ");
  32. >    scanf("%s", rest);
  33. >    printf("Enter size of new lines");
  34. >    scanf("%d", i);
  35.  
  36. This will not work. The reason why is explained in the FAQ for this newsgroup.
  37. To make it work, you could try to change it to
  38.  
  39.      scanf("%d", &(*(&i)));
  40.  
  41. Or you could try to read something about "stdio" in a good textbook.
  42.  
  43. >    index =0;
  44. >    writelines(rest, i);
  45. >}
  46.  
  47. >void writelines( char r[], int len)
  48. >{
  49. >int i;
  50. >       while (index < 80) {
  51. >     for  (i=0; i<len; i++)
  52. >     {
  53. >       putchar(r[index]);
  54. >       putchar('\n');
  55. >       }
  56. >        index++;
  57. >}
  58. >}
  59.  
  60. This will print the first char len times, in len different lines. Next
  61. it will print the second char len times, in len different lines. It
  62. will print all the characters that happen to be in the buffer declared
  63. in main() that are not overwritten by user input.
  64.  
  65. A word of general advice: Translating the bible without either a
  66. grammer or a dictionary for ancient hebrew is difficult. Without
  67. the original text, it becomes next to impossible.
  68.  
  69. Kurt
  70. -- 
  71. | Kurt Watzka                             Phone : +49-89-2180-6254
  72. | watzka@stat.uni-muenchen.de
  73. | ua302aa@sunmail.lrz-muenchen.de
  74.  
  75.